<template>
  <div>
      <myhead></myhead>
      <van-row>
        <van-col span="3"> <navigation></navigation>  </van-col>
        <van-col span="21"> 
            <br>
             组织名称：<input type="text"> <van-button>查询</van-button>  <van-button>重置</van-button>  <br>
             <br>
             <van-button>新增</van-button>  <van-button>导出</van-button>  <van-uploader :after-read="uploader">
                    <van-uploader>
                        <van-button icon="plus" type="primary">导入文件</van-button>
                    </van-uploader>
                    </van-uploader>
             <br> <br>
            <table width="800px">
                <tr>
                    <td>组织名称</td>
                    <td>组织编码</td>
                    <td>组织类型</td>
                    <td>组织排序</td>
                    <td>操作</td>
                    
                </tr>
                <tr>       
                    <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"> 
                    </el-tree>
                </tr>
                
            </table>
        </van-col>
        
      </van-row>
      
  </div>
</template>

<script>
import Myhead from './myhead.vue'
import navigation from './navigation.vue'
import axios from 'axios'
// import axios from '../http/axios'

export default {
    data(){
        return{
            list:[],
            data: [{
          label: '一级 1',
          children: [{
            label: '二级 1-1',
            children: [{
              label: '三级 1-1-1'
            }]
          }]
        }, {
          label: '一级 2',
          children: [{
            label: '二级 2-1',
            children: [{
              label: '三级 2-1-1'
            }]
          }, {
            label: '二级 2-2',
            children: [{
              label: '三级 2-2-1'
            }]
          }]
        }, {
          label: '一级 3',
          children: [{
            label: '二级 3-1',
            children: [{
              label: '三级 3-1-1'
            }]
          }, {
            label: '二级 3-2',
            children: [{
              label: '三级 3-2-1'
            }]
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        }
        }
    },
    components:{
        Myhead,
        navigation
    },
    methods:{
        getlist1(){
           axios({url:'/list',method:'get'}).then(res=>{
              console.log(res);
              this.list = res.list
          })
        },
        handleNodeClick(data) {
        console.log(data);
      },
      uploader(file) {
        let formData = new FormData()
        formData.append('file', file.file)
        axios({method: 'post',url: '/upload', data: formData}).then(res => {
                console.log(res)
        })
  }
    },
    mounted(){
        this.getlist1()
    }
}
</script>

<style>

</style>


